package org.example;

public class Main {
    public static void main(String[] args) {
//        //数组下标异常
//        int[] arr = {1, 2, 4};
//        for (int i = 0; i <= arr.length; i++) {
//            System.out.println(arr[i]);
//        }
        //类型转换异常
        A b = new B(); //向上转型
        B b2 = (B)b;//向下转型，这里是 OK
        C c2 = (C)b;//这里抛出 ClassCastExceptio
    }
}
class A {}
class B extends A {}
class C extends A {}